<template>
  <div v-show="add" :add="add">
    <h2 @click="addshow">关闭</h2>
    <div>小明的爸爸有{{ money }}元</div>
    <h2>不使用sync修饰符</h2>
    <!-- 父组件给子组件传递 :money @updata:money是个自定义事件,只是名字叫做updata:money -->
    <Child :money="money" @updata:money="money = $event" />
    <h2>使用sync修饰符</h2>
    <Child2 :money.sync="money" @updata:money="money = $event" />
  </div>
</template>

<script type="text/javascript">
import Child from "./ChildTest/Child.vue";
import Child2 from "./ChildTest/Child2.vue";
export default {
  name: "SyncTest",
  data() {
    return {
      money: 100000,
    };
  },
  props: { add: { type: Boolean, default: false } },
  components: { Child, Child2 },
  methods: {
    addshow() {
      this.$emit("sss");
    },
  },
};
</script>

<style>
</style>